Skip to content

fix(permissions): fail closed on unreadable or invalid settings - #254

Merged
CrazyBoyM merged 2 commits into
mainfrom
fix/settings-permissions-fail-closed-253
Nov 2, 2026
Merged

CrazyBoyM merged 2 commits into
mainfrom
fix/settings-permissions-fail-closed-253

Conversation

@CrazyBoyM

@CrazyBoyM CrazyBoyM commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Closes #253.

A settings read/parse failure used to look like an absent file, dropping that source's deny/ask rules and potentially selecting an older .claude policy. Settings now return null only for genuinely missing files and throw a sanitized SettingsFileError for unreadable files, invalid JSON/root objects, or malformed permission fields. Valid settings, empty policies, unknown keys, and fallback/migration from an absent primary remain supported.

CLI and MCP startup validate policy before execution; permission checks also initialize missing contexts before auto-approval. ACP validates before connecting session dependencies. Web session failures return an error, and a failed new-session request closes the socket so queued messages cannot use the old policy. No dependencies or release versions are changed.

Validation:

  • Added 71 regressions covering all three sources, truncated/malformed files, EACCES/EPERM, directories, symlinks, schema errors, legacy fallback, persistence safety, rule precedence, modes, CLI/MCP/ACP/Web entrypoints, and the actual Write pipeline. The cross-platform CI selection includes them.
  • CI on 6ae6f73: Linux full suite 880 pass / 13 conditional skips / 0 fail; Windows focused suite 107 pass / 18 conditional skips / 0 fail; macOS focused suite 142 pass / 12 conditional skips / 0 fail. Format, architecture, typecheck, all three builds, and dependency regression audit passed. The macOS job was retried once after GitHub could not allocate a hosted runner; the retry passed.
  • Source CLI production tests and built Node CLI checks confirm text/JSON/stream-JSON exit 1 with a diagnostic and no target write. A real Write-pipeline comparison reproduced the write on base ed1cfe1 and blocked initialization on this branch; no model API was used.
  • A separate test-only commit canonicalizes Windows temporary workspace paths and waits for committed input frames in the existing AskUserQuestion regression. Its assertions remain intact; the TUI case also passed five consecutive local runs.
  • Full dependency audit reports 9 existing high findings, with 0 introduced findings against ed1cfe1; the lockfile is unchanged. Local sandbox-specific indicator/wrapper/project-root failures also reproduce on base, while the hosted Linux full suite is green.

@CrazyBoyM
CrazyBoyM marked this pull request as ready for review November 2, 2026 17:44
@CrazyBoyM
CrazyBoyM merged commit 2b8a532 into main Nov 2, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Security]: permissions.deny/ask are silently dropped when settings.json cannot be read — acceptEdits then auto-approves writes to protected paths

1 participant